using UnityEngine;
using System.Collections;

public class selecionou_char : MonoBehaviour {

	public Camera CameraMira;
	Transform PegaObj;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {		
 		
		if (Input.GetMouseButtonUp(0)) {
			RaycastHit hit;
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit)){	
				PegaObj =  hit.transform;
				if(PegaObj.tag == "CharPerso"){
					string nome = PegaObj.name;
					int pos = nome.IndexOf("(Clone)");
					Debug.Log(nome.Substring(0,pos));                	
				}
			}
        }
		
	}
}